package org.dslmagic.data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class ArrayGroup extends Group {

	private final Object[] array;
	private final List<Object> list;

	public ArrayGroup(Object[] array) {
		this.array = array;
		this.list = new ArrayList<Object>(array.length);
		this.list.addAll((List<Object>) Arrays.asList(array));
	}

	@Override
	public Iterator<?> iterator() {
		return list.iterator();
	}

	@Override
	public Object[] value() {
		Object[] array2 = Arrays.copyOf(array, list.size());
		return list.toArray(array2);
	}

	@Override
	public Object[] toArray() {
		return value(); 
	}

}
